package com.lagou.module2_6;

/**
 * @author wsl
 * @date 2021/7/12 19:38
 * @project_name javase
 */
public class Coder {
    private String name;     //姓名
    private int id;          //工号
    private double salary;   //工资

    //无参构造
    public Coder() {
    }

    //有参构造
    public Coder(String name, int id, double salary) {
        setName(name);
        setId(id);
        setSalary(salary);
    }

    //生成get\set方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        if(id>0){
            this.id = id;
        }else{
            System.out.println("该程序员的工号不合理哦");
        }
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        if(salary>=2000){
            this.salary = salary;
        }else{
            System.out.println("该程序员的工资不合理！！！");
        }
    }

    //声明一个成员方法work,用于记录程序员工作的行为。
    public void work(int id,double salary,String name){
        System.out.println("工号为"+id+"基本工资为"+salary+"的程序员"+name+"正在努力的写着代码......操作步骤描述...");
    }
}
